fix: limit Numba threads in Wilcoxon path of rank_genes_groups#4082
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4082 +/- ##
==========================================
+ Coverage 78.59% 78.63% +0.03%
==========================================
Files 118 119 +1
Lines 12745 12762 +17
==========================================
+ Hits 10017 10035 +18
+ Misses 2728 2727 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
3 tasks
Member
|
Looks great! Please merge JhonatanFelix#1 |
move to utils, slimmer tests
Contributor
Author
|
Done! @flying-sheep |
Member
|
wonderful, thank you! |
flying-sheep
pushed a commit
that referenced
this pull request
Apr 24, 2026
flying-sheep
added a commit
that referenced
this pull request
Apr 24, 2026
…xon path of rank_genes_groups) (#4088) Co-authored-by: Jhonatan Felix <108437587+JhonatanFelix@users.noreply.github.com>
flying-sheep
added a commit
that referenced
this pull request
Apr 26, 2026
Co-authored-by: Philipp A. <flying-sheep@web.de>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR limits Numba thread usage during the wilcoxon path of
scanpy.tl.rank_genes_groupsby temporarily applyingscanpy.settings.n_jobsvianumba.set_num_threads(.....)and restoring the previous value afterward.Implementation
_numba_thread_limit(....)context manager inscanpy.tools._rank_genes_groupsnumba.get_num_threads()/numba.set_num_threads(...)finallyblockmethod == "wilcoxon"Required checks
numba.set_num_threadswhenn_jobsis specified (e.g. inscanpy.tl.rank_genes_group) #2390Added some focused tests for the new numba thread-limiting behavior in
rank_genes_groups:method="wilcoxon"usingscanpy.settings.n_jobs